<?php

    include_once("php/functions.php");
    
    $result_checks = get_checks();
    $result_user = get_checks_user($me['id']);
    
    $count_check = mysql_num_rows($result_checks);
    $count_user = mysql_num_rows($result_user);
    
    $items_checks = mysql_fetch_rowsarr($result_checks);
    $items_user = mysql_fetch_rowsarr($result_user);
    $size=0;
    
    if($count_user == 0){
        
        for($i=0; $i< $count_check; $i++){
            addCheckToUser($me['id'], $items_checks[$i]['id'], $items_checks[$i]['desc_check'], 0);
        }
    }else{

        for($i=0; $i< $count_check; $i++){
            
            for($j=0; $j< $count_user; $j++){
                
                if($items_checks[$i]['id'] == $items_user[$j]['id']){
                    print_item($items_checks[$i]['id'], $items_checks[$i]['desc_check'], $items_user[$i]['estado']);
                    $size = $size+1;
                    break;
                }
                if($j == $count_user-1){
                    addCheckToUser($me['id'], $items_checks[$i]['id'], $items_checks[$i]['desc_check'], 0);
                    $size = $size+1;
                }
            }
        }
    }

?>
<input type="hidden" id="hidden" value="<?php echo $me['id'];?>"/>
<input type="hidden" id="size_hidden" value="<?php echo $size;?>"/>

